import React, { Component } from "react";
import Child1 from "./Child1";
import Child2 from "./Child2";

class App extends Component {
  state = {
    count: undefined,
  };

  getCount(count) {
    // console.log(num);
    this.setState({
      count,
    });
  }

  render() {
    return (
      <>
        <h2>状态提升 - {this.state.count}</h2>
        <Child1 onGetCount={this.getCount.bind(this)} />
        <Child2 count={this.state.count} />
      </>
    );
  }
}

export default App;
